import { defineStore } from "pinia";
export let definePerson = defineStore({
  id: "store", //id唯一属性
  state: () => ({//状态,这里面都是响应式数据
    username: "张三",
    age: 0,
    hobbies: ["唱歌", "跳舞"],
  }),
  getters: {
    getHobbiesCount() {
      return this.hobbies.length;
    },
    getAge() {
      return this.age;
    },
  },
  actions: {
    doubleAge() {
      this.age = this.age * 2;
    },
  },
});
